<template>
  <n-flex class="echarts-box-small">
    <v-chart :option="option" autoresize :loading="false"/>
  </n-flex>
</template>

<script setup>

// 组件接收的值
import {defineProps, reactive} from "vue";

const props = defineProps({
  optionData: {
    type: Array,
    default: ['默认1','默认2','默认3','默认4','默认5']
  },
  optionSeriesName: {
    type: String,
    default: '默认1'
  },
  optionSeriesData: {
    type: Array,
    default: [120, 132, 101, 134, 90, 230, 210]
  }
})

const option = reactive({
  title: {
    text: '模型性能评估'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: { type: 'shadow' }
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  xAxis: [{
    type: 'category',
    data: props.optionData,
    axisTick: { alignWithLabel: true }
  }],
  yAxis: [{
    type: 'value'
  }],
  series: [{
    name: props.optionSeriesName,
    type: 'bar',
    barWidth: '60%',
    data: props.optionSeriesData
  }]
})
</script>

<style scoped>

</style>
